import axios from 'axios';

let base = 'http://localhost:8080';

export const requestLogin = params => {
    return axios.post(`${base}/login`, params).then(res => res.data);
};

export const getUserList = params => {
    return axios.get(`${base}/user/list`, {
        params: params
    });
};

export const getUserListPage = params => {
    return axios.get(`${base}/user/listpage`, {
        params: params
    });
};

export const removeUser = params => {
    return axios.get(`${base}/user/remove`, {
        params: params
    });
};

export const batchRemoveUser = params => {
    return axios.get(`${base}/user/batchremove`, {
        params: params
    });
};

export const editUser = params => {
    return axios.get(`${base}/user/edit`, {
        params: params
    });
};

export const addUser = params => {
    return axios.get(`${base}/user/add`, {
        params: params
    });
};

/*

/!**** 部门管理 **** *!/
// 获取部门列表数据（分页+高级查询）
export const getDepartments = params => {
    return axios.post(`${base}/department`, params);
};

// 删除部门数据
export const removeDepartment = params => {
    return axios.delete(`${base}/department/` + params);
}

// 批量删除部门数据 
export const batchRemoveDepartments = params => {
    return axios.patch(`${base}/department`, params);
}

// 获取全部部门数据
export const getDepartmentTree = params => {
    return axios.get(`${base}/department/tree`);
}

// 部门数据编辑（添加/修改)
export const editDepartment = params => {
    return axios.put(`${base}/department`,params);
}



/!**** 员工管理 **** *!/
// 获取全部员工信息
export const getEmployeeList = params => {
    return axios.get(`${base}/employee`);
}

// 获取部门列表数据（分页+高级查询）
export const getEmployees = params => {
    return axios.post(`${base}/employee`, params);
};

// 删除部门数据
export const removeEmployee = params => {
    return axios.delete(`${base}/employee/` + params);
}

// 批量删除部门数据 
export const batchRemoveEmployees = params => {
    return axios.patch(`${base}/employee`, params);
}

// 部门数据编辑（添加/修改)
export const editEmployee = params => {
    return axios.put(`${base}/employee`,params);
}



/!**** 店铺管理 **** *!/
// 获取全部员工信息
export const getShopList = params => {
    return axios.get(`${base}/shop`);
}

*/


/**** 数据字典管理啊 **** */
// 获取数据字典类型信息（分页+高级查询）
export const getSystemDictionaryTypes = params => {
    return axios.post(`${base}/systemDictionaryType`,params);
}

// 数据字典类型增改
export const editSystemDictionaryType = params => {
    return axios.put(`${base}/systemDictionaryType`,params);
}

// 删除单个数据字典类型
export const removeSystemDictionaryType = params => {
    return axios.delete(`${base}/systemDictionaryType/` + params);
}

// 批量删除数据字典类型
export const batchSystemDictionaryTypes = params => {
    return axios.patch(`${base}/systemDictionaryType`, params);
}

/**** 数据字典明细管理啊 **** */
// 获取数据字典对应类型的明细（分页+高级查询）
export const getSystemDictionaryDetails = params => {
    return axios.post(`${base}/systemDictionaryDetail`,params);
}

// 数据字典明细
export const editSystemDictionaryDetail = params => {
    return axios.put(`${base}/systemDictionaryDetail`,params);
}

// 删除单个数据字典类型
export const removeSystemDictionaryDetail = params => {
    return axios.delete(`${base}/systemDictionaryDetail/` + params);
}

// 批量删除数据字典类型
export const batchSystemDictionaryDetail = params => {
    return axios.patch(`${base}/systemDictionaryDetail`, params);
}